The present disclosure relates generally to memory management of processing systems and, in particular, to memory management of processing systems running in a virtual computer environment and/or processes running in an operating system environment.
Computer systems contain non-volatile mass storage devices (e.g., hard disk drives) to hold program and data files. The contents of these files are loaded into a Random Access Memory (RAM)-type system memory in order to be accessed or executed by a computer processing unit (CPU) of the computer system. This loading operation is typically performed by an operating system (OS) on behalf of application programs. Where the computer system employs processors running virtual machines, these loading operations may be facilitated through the use of virtual memory and demand paging functions. In a virtual machine environment, applications do not directly use system memory addresses to designate the code and data they use; rather, the applications use “virtual addresses” to designate memory locations, which are translated into system memory addresses by a paging mechanism implemented by CPU circuits under the control of the OS. This allows the OS to avoid having to load program and data files in their entirety into RAM. Instead, system memory is divided into segments, or “chunks” of a particular size (referred to as “pages”), and the OS loads the corresponding segment of file contents into each memory page only at the time this specific page is accessed. There are several variants of this method, such as fault-ahead (load accessed pages AND nearby-pages that are expected to be used in the future). In general, these implementations are referred to as “demand paging.”
One disadvantage of the above is that RAM is typically required to hold the contents of programs and data files, thereby reducing the amount of RAM available for other purposes, and also requires some time to download the contents into RAM. Virtualization techniques have been developed that enhance the memory management but also impose additional challenges. Virtualization may be implemented by a software program, often referred to as a “hypervisor” or “virtual machine manager,” which runs on a single computer system but allows multiple “guest” operating systems to run concurrently, each in a separate “virtual machine.” Accesses to these virtual components are intercepted by the hypervisor and translated into accesses to real components. This allows the use of demand paging on the guest operating system memory (e.g., guests can have more memory than is physically available and is referred to as memory over-commitment). However, if the same program or data is concurrently accessed by multiple guests running under the same hypervisor, each guest operating system will separately allocate virtual RAM to hold these contents, and the hypervisor may then need to allocate multiple identical copies of the contents in physical RAM.
Techniques, such as execute in place with shared memory, have been developed to avoid the allocation of multiple identical copies. Sharable pages are put in a shared memory zone and every memory access is diverted to the shared memory. This technology involves a complex setup and is lacks the ability to transparently handle system updates. As a result, this technology can only be used in a limited amount of use cases.
Techniques, such as content-based page sharing, have been developed to minimize the allocation of multiple identical copies of contents into physical RAM. Using a scanning feature, page copies are scanned and identified by their contents. Pages with identical contents can be shared with other resources without duplication. However, the scanning process to identify sharing opportunities is time consuming and prohibitively expensive to employ.
What is needed, therefore, is a way to identify storage pages with the same content for user programs and/or virtual machines while minimizing the amount of CPU power and memory bandwidth typically required using other techniques, such as page scanning.